<template>
  <div>
    <!-- 顶部 -->
    <header>
      <!-- Logo -->
      <img src="@/assets/logo.png" alt="红梅食品 Logo" style="max-height: 35px;">

      <!-- 菜单按钮（移动端可见） -->
      <button class="menu-toggle" @click="toggleMenu">☰</button>

      <!-- 浮窗音乐播放器 -->
      <div class="music-float" id="music-float">
        <button id="music-toggle" class="music-button">🔊</button>
      </div>

      <!-- 音乐播放器 -->
      <audio id="background-music" loop autoplay>
        <source src="@/assets/music.mp3" type="audio/mpeg">
        您的浏览器不支持音频播放。
      </audio>

      <!-- 导航菜单 -->
      <!--      <nav id="mobile-nav" :class="{'active': isMenuActive}">-->
      <nav id="action" :class="{'active': isMenuActive}">
        <router-link to="/">首页</router-link>
        <router-link to="/introduction">红梅简介</router-link>
        <router-link to="/material">原料介绍</router-link>
        <router-link to="/makeProduct">制作过程</router-link>
        <router-link to="/SuperMarket">开始投放市场</router-link>
      </nav>
    </header>

    <!-- 关于红梅 -->
    <div class="container">
      <h2 style="text-align: center">红梅食品</h2>
    </div>

    <!-- 产品海报 -->
    <div class="poster">
      <img src="@/assets/海报.jpg" alt="红梅产品海报">
    </div>

    <!-- 页脚 -->
    <footer>
      <p>红梅食品 创造生活高品质</p>
      <p>HONGMEI FOOD CREATES HIGH QUALITY OF LIFE</p>
    </footer>
  </div>
</template>

<script>
export default {
  name: 'App',
  data() {
    return {
      isMenuActive: false  // 控制菜单显示与隐藏
    };
  },
  methods: {
    // 切换菜单显示状态
    toggleMenu() {
      this.isMenuActive = !this.isMenuActive;
    }
  }
}
</script>

<style scoped>
/* 全局样式 */
body {
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  background-color: #f9f9f9;
  line-height: 1.6;
}

/* 顶部导航 */
header {
  background-color: #d00000;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  position: relative;
}

header img {
  max-height: 50px;
}

/* 菜单按钮 */
.menu-toggle {
  display: none;
  font-size: 1.5rem;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
}

/* 导航菜单 */
nav {
  display: flex;
  gap: 1rem;
}

nav a {
  color: white;
  text-decoration: none;
  font-size: 1rem;
}

nav a:hover {
  text-decoration: underline;
}

/* 移动端样式 */
@media (max-width: 768px) {
  .menu-toggle {
    display: block;
  }

  nav {
    display: none;
    flex-direction: column;
    background-color: #d00000;
    position: absolute;
    top: 100%;
    right: 0;
    width: 100%;
    padding: 1rem 0;
  }

  nav a {
    padding: 0.5rem 1rem;
  }

  nav.active {
    display: flex !important;
  }
}

/* 主内容区域 */
.container {
  margin: 1rem auto;
  padding: 1rem;
  width: 100%;
  background-color: white;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
}

.container h2 {
  margin-top: 0;
  color: #d00000;
  font-size: 1.5rem;
  border-bottom: 2px solid #d00000;
  padding-bottom: 0.5rem;
}

/* 产品图片 */
.poster img {
  display: block;
  width: 100%;
  border-radius: 8px;
}

/* 页脚 */
footer {
  background-color: #d00000;
  color: white;
  text-align: center;
  padding: 1rem 0;
  margin-top: 2rem;
}

/* 浮窗音乐播放器样式 */
.music-float {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: #fff;
  padding: 10px;
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.music-button {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #d00000;
  cursor: pointer;
}
</style>
